<div class="clearfix"><h2>今日优惠券</h2></div>
<div class="p10 center">
	<a href="#" class="premium" title="领取优惠券" style="height:135px;display:block;"><img src="/images/ajax-loader.gif" width="195" height="135" id="premium_thumb" /><div id="valid_date" style="top:-15px;position:relative;display:none;color:#000000;"></div></a>
	<div class="youhuiq"><span class="fl"><!-- 剩余&nbsp;<b id="num_premium"><?php echo $result['nums']; ?></b>&nbsp;张 --><a href="" id="storelink" target="_blank">去店铺看看</a></span><span class="fr" id="isget"><p id="people_num" style="float:left;font-size:20px;color:red;font-weight:bold;line-height:20px;position:relative;top:-2px;"></p>人已领取</span></div>
</div>
<script type="text/javascript">
premium_url = null;
$(document).ready(function(){
	$.getJSON("<?php echo spUrl('tags', 'index_premium'); ?>",  function(premium_data){
		if(premium_data.activity_id) {
			$('#premium_thumb').attr('src', '/uploadfiles/' + premium_data.thumb);
			$('#storelink').attr('href', premium_data.storelink);
			$('#valid_date').html(premium_data.valid_date);
			if(premium_data.isget == 1) {
				$('#isget').html('已领取');
				$('.premium').bind('click', function(){
					if(confirm('您已领取本次活动的优惠券，想去店铺看看么?') == true) {
						$(this).attr('target', '_blank');
						$(this).attr('href', premium_data.storelink);
					}
				});
				return false;
			} else {			
				$('#people_num').html(premium_data.use_count);
			}
			$('.premium').hover(function(){
				$('#valid_date').show();
			}, function(){
				$('#valid_date').hide();
			});
			$('.premium').bind('click', function(){
				if(confirm('确认要领取优惠券么?') == true) {
					$(this).attr('target', '_blank');
					$(this).attr('href', premium_url);
				} else {
					$(this).attr('target', '_self');
					$(this).attr('href', '#');
				}
			});
			
			premium_url = premium_data.premium_url;
		} 
	})
})
</script>